package com.youmu.sichuansfc.controller.fund;

import com.youmu.sichuansfc.common.CommonRes;
import com.youmu.sichuansfc.domain.YoumuFundManager;
import com.youmu.sichuansfc.domain.pojo.SearchYoumuFundManagerFund;
import com.youmu.sichuansfc.service.FundManagerService;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 基金管理人 信息 外部接口
 * @author WYZ
 * @create 2018-01-30 17:55
 * @desc
 **/
@Controller
public class FundManagerOutController {

    private Logger logger  = Logger.getLogger(this.getClass());
    @Autowired
    FundManagerService fundManagerService;



    /**
     *  查询改账户下基金管理人信息
     * @param
     * @return
     */
    @RequestMapping(value = "/fund/manager/out/detail", method = RequestMethod.GET)
    public @ResponseBody  CommonRes fundManagerout(@RequestParam(name = "name") String name){

        try {
            YoumuFundManager youmuFundManager =  fundManagerService.findByManagerName(name);
            return CommonRes.success(youmuFundManager);
        }catch (Exception e){
            e.printStackTrace();
        }
        return CommonRes.fail();
    }

    /**
     * 查询单个基金详情
     * @param fundId
     * @return
     */
    @RequestMapping(value = "/fund/manager/fund/out/detail", method = RequestMethod.GET)
    public @ResponseBody CommonRes fundout(@RequestParam(name = "name") String name){
        try {
            SearchYoumuFundManagerFund searchYoumuFundManagerFund = fundManagerService.findFundByName(name);
            return CommonRes.success(searchYoumuFundManagerFund);
        }catch (Exception e){
            e.printStackTrace();
        }
        return  CommonRes.fail();
    }
}
